clear all
tic
%mcvar=zeros(5001,1);

    randseed=randn(5000,30000);
    sampleW4=oupath(randseed,0,1,1,0).^4;
    %mcvar=mcvar+sum(midpoint(samplepaths).^2,2);
    %mcvar=mcvar+sum(sampleW4,2);
    mcvar=sum(sampleW4,2);
mcvar=mcvar/30000;
toc

% a=1;b=1;m=1;yic=1;
time=(0:5000)*0.5/5000;
% exactvar=b^2/2/a*(1-exp(-2*a*time))'+(m+(yic-m)*exp(-a*time)).^2';
plot(time,mcvar)
% hold on
% plot(time,exactvar,'r')